using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.Text.RegularExpressions
{
    /// <summary>
    /// 正则表达式模式字符串
    /// </summary>
    public static class RegexPattern
    {
        /// <summary>
        /// 手机
        /// </summary>
        public const string MobilePhone = @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$";
        /// <summary>
        /// 身份证
        /// </summary>
        public const string IDCard = @"^\d{15}|\d{18}$";
        /// <summary>
        /// QQ号，5至11位数字
        /// </summary>
        public const string QQ = @"^[1-9][0-9]{4,10}$";
        /// <summary>
        /// 微信号，6至20位，以字母开头，字母，数字，减号，下划线
        /// </summary>
        public const string WeChat = @"^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$";
        /// <summary>
        /// 车牌号
        /// </summary>
        public const string PlateNumber = @"^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";
        /// <summary>
        /// IPv4地址
        /// </summary>
        public const string IPv4 = @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
        /// <summary>
        /// RGB Hex 十六进制颜色
        /// </summary>
        public const string RGBHex = @"^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$";

        #region 数字

        /// <summary>
        /// 零 和 带两位小数的正实数
        /// </summary>
        public const string ZeroAndTwoPositiveRealNumbers = @"^([1-9][0-9]*)+(.[0-9]{1,2})?$";

        #endregion

        #region 内置

        /// <summary>
        /// 电子邮箱
        /// </summary>
        public const string Email = @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";
        /// <summary>
        /// 电话
        /// </summary>
        public const string Phone = @"^((d{3,4})|d{3,4}-)?d{7,8}$";
        /// <summary>
        /// Url（增加 端口匹配 (:[\d]{1,5}\/)? ）
        /// </summary>
        public const string Url = @"^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:[\d]{1,5}\/)?([\/\w \.-]*)*\/?$";

        #endregion
    }
}
